cmake_minimum_required(VERSION 3.26)
project(AudioAndVideo)

set(CMAKE_CXX_STANDARD 17)

set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/output/debug)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PROJECT_SOURCE_DIR}/output/debug)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/output/release)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PROJECT_SOURCE_DIR}/output/release)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(QT_VERSION 5)
set(REQUIRED_LIBS Core Widgets Gui
)
set(REQUIRED_LIBS_QUALIFIED Qt${QT_VERSION}::Core
        Qt${QT_VERSION}::Widgets
        Qt${QT_VERSION}::Gui
)

find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
include_directories(src
)

include_directories(src
        third_party/ffmpeg431/include
        third_party/sdl2-2.28.1/include
)

file(GLOB HEADERS
        src/*.h
)
file(GLOB SOURCES
        src/*.cpp
)

add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")

file(GLOB LIB_FFMPEG ${PROJECT_SOURCE_DIR}/third_party/ffmpeg431/lib/x64/*.lib)
link_directories(${PROJECT_SOURCE_DIR}/third_party/ffmpeg431/lib/x64)

file(GLOB LIB_SDL ${PROJECT_SOURCE_DIR}/third_party/sdl2-2.28.1/lib/x64/SDL2.lib)
#link_directories(${PROJECT_SOURCE_DIR}/third_party/sdl2-2.28.1/lib/x64)

if (CMAKE_BUILD_TYPE AND (CMAKE_BUILD_TYPE STREQUAL "Debug"))
else ()
endif ()

add_executable(${PROJECT_NAME} WIN32 main.cpp ${HEADERS} ${SOURCES})

target_link_libraries(${PROJECT_NAME} ${REQUIRED_LIBS_QUALIFIED} ${LIB_FFMPEG} ${LIB_SDL})
